-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement default-field-values
#19001
Conversation
4adec34
to
3b0f463
Compare
64677bb
to
88b70c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small thing but otherwise lgtm!
crates/hir-def/src/lib.rs
Outdated
@@ -516,6 +516,7 @@ pub type LocalModuleId = Idx<nameres::ModuleData>; | |||
pub struct FieldId { | |||
pub parent: VariantId, | |||
pub local_id: LocalFieldId, | |||
pub has_default: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized we have t his in FieldData
already, so we can't we reuse that instead? If we have the ID we can trivially index into the variant_data
where required.
crates/hir/src/lib.rs
Outdated
@@ -1414,7 +1418,7 @@ impl Struct { | |||
.variant_data | |||
.fields() | |||
.iter() | |||
.map(|(id, _)| Field { parent: self.into(), id }) | |||
.map(|(id, d)| Field { parent: self.into(), id, has_default: d.has_default }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is here we can fetch it via variant_data[id]
since we already have db.struct_data(self.id).variant_data
anyways
I'm rebasing to resolve conflicts 😄 |
Ah, sorry :) |
c7949cf
to
8aa6c09
Compare
Nevermind. They were quite easy to resolve |
…-default-fields internal: backout `hir-*` changes from #19001
Resolves #18938